package cn.net.xinyi.xs {
	
	import cn.net.xinyi.xs.controller.LoadColumnChartCommand;
	import cn.net.xinyi.xs.controller.LoadOrgansCommand;
	import cn.net.xinyi.xs.controller.LoadPieChartCommand;
	import cn.net.xinyi.xs.controller.RamsStartupCommand;
	
	import org.puremvc.as3.multicore.patterns.facade.Facade;
		
	public class RamsFacade extends Facade {
		
		public static const RAMS_STARTUP:String = 'rams_startup';
		public static const LOAD_ORGANS:String = 'load_organs';
		public static const LOAD_CHARTS:String = 'load_charts';
		
		public function RamsFacade(key:String) {
			super(key);
		}
		
		public static function getInstance(key:String):RamsFacade {
			if (instanceMap[key] == null)
				instanceMap[key] = new RamsFacade(key);
			return instanceMap[key] as RamsFacade;
		}
		
		override protected function initializeController():void {
			super.initializeController();
			registerCommand(RAMS_STARTUP, RamsStartupCommand);
			registerCommand(LOAD_ORGANS, LoadOrgansCommand);
			registerCommand(LOAD_CHARTS, LoadColumnChartCommand);
		}
		
		public function startup(app:rams):void {
			sendNotification(RAMS_STARTUP, app);
		}
	}
}